
<?php
//<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

 
/*
 *    ieBody.php
 *
 *    Body of system for especially for IE since google maps
 *    will not work in a table in IE.
 *
 *
 *
 *
 * LICENSE:
 *
 *   Copyright 2005 Matt Kubilus
 *
 *   This file is part of crimemap.
 *
 *   Crimemap is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   Crimemap is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with Crimemap; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*	echo '<br><br><span style="border: 1px solid #666;float:left;width:500px;height:600px">
	 <script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAA8ZOlRYjf9r6w95uNvvw0khSGVT6R9T0N9RKkACEZKikgRg_w1xSa00EzxwY86Xo5EgUr5ybUNDxbDA" type="text/javascript"></script>
	<div id="map" style="width: 500px; height: 600px"></div><br></span>';
*/

 //echo "<p><span style='float:left;width:50%;height:100%'>";
 
// echo "<p><span style='position:relative;top:5px;left:25px'><br><br>";
 
 	echo '
	<br>
	<br>
	<div class="floatright">
	
		<script src="http://maps.google.com/maps?file=api&v=1&key='; echo $key;
		
		echo '" type="text/javascript">
		</script>
			<div id="map" style="width: 500px; height: 600px">
			</div>
		<br>

	</div>';
 
 
 
 
	switch($id)
	{
		case 'login':
		include 'login.html';
		break;

		case 'loggedin';
		include 'login.php';
		$_SESSION['userid'] = $userid;
		break;

		case 'adduser':
		include 'newUser.html';
		break;

		case 'addactivity':
		if($_SESSION['userid'] > 0)
		{	
			include 'addActivity.html';
		}	
		else
		{
			echo "You must login first";
		}
		break;
		
		case 'activityAdded';
		include 'addActivity.php';
		break;
				
		case 'useradded':
		include 'newUser.php';
		break;
		
		case 'logout';
		$_SESSION['userid'] = -1;
		unset($_SESSION['userid']);
		echo "Logged out.";
		break;
		
		case 'home';
		$mode = 'all';
		include 'report.php';
		break;
		
		default:
		require 'report.php';
	}	

	//echo "</span></p>";


	
	include 'footer.php'; 
	
	//echo '</span></p></div>';

	echo '</div>';

 	
 	
/*echo "<p><span style='float:left;width:40%;height:100%'>";*/



?>

   


   
    

    
    
    <script type="text/javascript">
    //<![CDATA[
    
    var map = new GMap(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.centerAndZoom(
    new GPoint('-85.330675', '34.996902'), 2);

	function createMarker(point, message) {
	  var marker = new GMarker(point);

	  GEvent.addListener(marker, "click", function() {
	    marker.openInfoWindowHtml(message);
	  });

	  return marker;
	}
    

    <?php 

	$db = new dbConnection();
	$db->connect($host,$dbuser,$dbpwd,$dbname);
	$act = new activity($db);
	$db->execute("SELECT address, longitude, latitude, CAST(description AS CHAR(32)) AS description, datetime FROM crimemap_activity LIMIT 0, 20");
	$result = $db->getResults();
	$num = $db->getNumRows();	

	$i=0;
	while ($i < $num) 
	{

		$address=mysql_result($result,$i,"address");
		$description=mysql_result($result, $i, "description");
		$datetime=mysql_result($result, $i, "datetime");
		
		//$loc = $act->geocode($address);

		$latitude = mysql_result($result, $i, "latitude");
		$longitude = mysql_result($result, $i, "longitude");

		$i++;
		
    ?>
	    
    var point = 
    new GPoint(<?php echo $longitude;?>, <?php echo $latitude;?>);
    var marker =  createMarker(point, "<?php echo $address ?> <?php echo "<p>"; echo $description; echo "<p>"; echo $datetime ?>");
    map.addOverlay(marker);
    
    <?php

	    }  //End while
		$db->disconnect();
    ?>

    //]]>
    </script>


